package org.fast.develop.logicflow.springboot.configuration.listener;

import org.fast.develop.logicflow.management.core.event.DeployedEvent;
import org.fast.develop.logicflow.management.core.listener.LogicListener;
import org.fast.develop.logicflow.runtime.cache.LogicDefinitionCache;

/**
 * @author 莫寅
 * @createTime 2022-06-09 16:23
 * @desc：
 */
public class ModelDeployedListener implements LogicListener<DeployedEvent> {

    private LogicDefinitionCache logicDefinitionCache;

    public ModelDeployedListener(LogicDefinitionCache logicDefinitionCache) {
        this.logicDefinitionCache = logicDefinitionCache;
    }

    @Override
    public void onEvent(DeployedEvent event) {
        //发布成功后清除缓存
        logicDefinitionCache.remove(event.getSource().getKey());

    }

}
